import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:vape_xe/utils/extension.dart';
import 'package:vape_xe/values/values.dart';

import 'child/view.dart';
import 'logic.dart';

class ProceedsView extends GetView<ProceedsController> {
  const ProceedsView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios_new_rounded),
          onPressed: () => {Navigator.of(context).pop('刷新')},
        ),
        title: Text('Details of proceeds'.tr),
      ),
      body: Column(
        children: [
          10.hGap,
          Container(
            margin: EdgeInsets.symmetric(horizontal: 16.w),
            padding: EdgeInsets.all(2.w),
            height: 44.h,
            decoration: BoxDecoration(
              color: Colors.white10,
              borderRadius: 100.radius,
            ),
            child: TabBar(
              tabs: controller.tabTitles.map((e) => Tab(text: e)).toList(),
              controller: controller.tabController,

              /// 下面不要横线
              dividerHeight: 0,

              /// indicator占满整个Tab空间
              indicatorSize: TabBarIndicatorSize.tab,
              indicator: BoxDecoration(
                gradient: const LinearGradient(colors: [Color(0xffF5B946), Color(0xffF58546)]),
                borderRadius: 100.radius,
                boxShadow: [Shadows.primaryIndicatorShadow],
              ),

              /// labelStyle里面设置color还无效
              unselectedLabelStyle: TextStyle(fontSize: 14.sp, fontFamily: 'Montserrat', fontWeight: FontWeight.bold),
              labelStyle: TextStyle(fontSize: 14.sp, fontFamily: 'Montserrat', fontWeight: FontWeight.bold),
              labelColor: AppColors.primaryText,
              unselectedLabelColor: AppColors.primaryText,
            ),
          ),
          12.hGap,
          Expanded(
            child: TabBarView(
              controller: controller.tabController,
              children: [
                ProceedsListView(tag: "1"),
                ProceedsListView(tag: "2"),
              ],
            ),
          )
        ],
      ),
    );
  }
}
